<template>
  <BasicDrawer v-bind="$attrs" @register="register" :title="displayModuleTitle" width="60%">
    <ViewUnitSvg mode="onlySvg" :svgData="svgData" />
  </BasicDrawer>
</template>

<script lang="ts">
  import { defineComponent, ref, unref, computed, reactive, onMounted } from 'vue';
  import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
  import { OperationTypeEnum } from '/@/enums/appEnum';
  import { QcUnifyTransToChildProps } from '/#/QcUnify';
  import { displayTitle } from '/@/utils/QcUnifyUtil';
  import ViewUnitSvg from '../unitDivision/UnitHazardSvgView.vue';
  export default defineComponent({
    components: { BasicDrawer, ViewUnitSvg },
    emits: ['register', 'success'],
    setup() {
      const dataId = ref('');
      const svgData = ref();
      const qcUnifyProps = ref<QcUnifyTransToChildProps>();
      const [register, { closeDrawer }] = useDrawerInner((data) => {
        if (data != undefined && data != null) {
          let unrefData = unref(data);
          qcUnifyProps.value = unrefData;
          dataId.value = data.dataId;
          svgData.value = data.svgData;
        }
      });
      let displayModuleTitle = computed(() => {
        return displayTitle(qcUnifyProps.value);
      });
      return {
        register,
        svgData,
        dataId,
        displayModuleTitle,
        qcUnifyProps,
      };
    },
  });
</script>

<style scoped></style>
